from manim import *
from numpy import flip, insert

LV,QL,QH,JH='#75cfb8','#bbdfc8','#f0e5d8','#ffc478'

class p1(MovingCameraScene):
    def construct(self):
        # self.add(NumberPlane())
        # self.camera.frame.scale(0.5)
        # x^2+y^2=r^2 6,8,10
        x=ValueTracker(50)
        r1=41
        r2=r1+9
        t=13
        c1,c2=Circle(r1/t).shift(LEFT*9/t).set_fill(WHITE,1),Circle(r2/t).set_fill(LV,1)
        o,a,b,c,d=ORIGIN,c2.get_top(),c2.get_bottom(),c2.get_right(),c2.get_left()
        a_,b_,c_=a+DOWN*10/t,b+UP*10/t,c1.get_right()
        aa_,bb_,cc_=Line(a,a_),Line(b,b_),Line(c,c_)
        self.add(c2,c1,Dot(o),aa_,bb_,cc_,
            DashedLine(a,b),
            DashedLine(c,d),
            MathTex('10').next_to(aa_),
            MathTex('10').next_to(bb_),
            MathTex('18').next_to(cc_,UP),
            Angle(Line(o,c),Line(o,a),elbow=True)
        )
        self.wait()

class p2(MovingCameraScene):
    def construct(self):
        # self.add(NumberPlane())
        # self.camera.frame.scale(0.5)
        # x^2+y^2=r^2 6,8,10
        x=ValueTracker(50)
        r1=41
        r2=r1+9
        t=13
        c1,c2=Circle(r1/t).shift(LEFT*9/t).set_fill(WHITE,1),Circle(r2/t).set_fill(LV,1)
        o,a,b,c,d=ORIGIN,c2.get_top(),c2.get_bottom(),c2.get_right(),c2.get_left()
        a_,b_,c_=a+DOWN*10/t,b+UP*10/t,c1.get_right()
        aa_,bb_,cc_=Line(a,a_),Line(b,b_),Line(c,c_)
        self.add(c2,c1,Dot(o),aa_,bb_,cc_,
            DashedLine(a,b),
            DashedLine(c,d),
            MathTex('10').next_to(aa_),
            MathTex('10').next_to(bb_),
            MathTex('18').next_to(cc_,UP),
            Angle(Line(o,c),Line(o,a),elbow=True)
        )
        # p2
        o_=c1.get_center()
        self.add(Dot(o_),Line(o,o_),Line(o,a_),Line(o_,a_),
            MathTex('O').next_to(o,DR),
            MathTex('O^\prime').next_to(o_,DL),
            MathTex('A').next_to(a_,DR),
            MathTex('r').move_to([-0.5,1.5,0])
        )
        self.wait()